/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kmcsoft.goldshop.model.master;

import com.kmcsoft.core.entity.IdentityEntity;
import javax.jdo.annotations.Column;
import javax.jdo.annotations.FetchGroup;
import javax.jdo.annotations.FetchGroups;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.Unique;

/**
 *
 * @author kmcsoft02
 * //nu trang ytaly/DB.. vietnam
 */
@PersistenceCapable(detachable = "true", table = "SHOP_PremiumJewelryType")
@FetchGroups(value = {
    @FetchGroup(name = "detach_PremiumJewelryType_All", members = {
        @Persistent(name = "currency"),
        @Persistent(name = "unit")}),
    @FetchGroup(name = "detach_PremiumJewelryType_Unit", members = {
        @Persistent(name = "unit")}),
    @FetchGroup(name = "detach_PremiumJewelryType_Currency", members = {
        @Persistent(name = "currency")})
})
public class PremiumJewelryType extends IdentityEntity {

    public final static boolean GROUP_SPECIAL = true;
    public final static boolean GROUP_NORMAL = false;
    
    @Persistent
    @Unique
    private String code;
    @Persistent
    private String name;
    @Persistent
    private boolean group;// nhom 1, nhom 2
    @Persistent
    private Unit unit;
    @Persistent
    @Column(defaultValue = "0")
    private double unitPrice;
    @Persistent
    private Currency currency;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isSpecialGroup() {
        return group;
    }
    public boolean isNormalGroup() {
        return group;
    }

    public void setGroup(boolean group) {
        this.group = group;
    }

   

    public Unit getUnit() {
        return unit;
    }

    public void setUnit(Unit unit) {
        this.unit = unit;
    }

    public double getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(double unitPrice) {
        this.unitPrice = unitPrice;
    }

    public Currency getCurrency() {
        return currency;
    }

    public void setCurrency(Currency currency) {
        this.currency = currency;
    }
    
    public String getColor(){
        if(group==GROUP_SPECIAL){
            return "color-group-special";
        }
        if(group==GROUP_NORMAL){
            return "color-group-normal";
        }
        
        return "";
    }
}
